package DramCore
{
	import mx.containers.Canvas;
	import mx.core.Application;
	import flash.events.MouseEvent;
	
 	public class  Place extends Canvas {

		private var _entryScriptCalled:Boolean;
		
		public function Place(name:String, background:String = ""):void {
			this.name = name;
			this._entryScriptCalled = false;
			if( background != ""){
				this.newPlaceLayer( background, 0, 0, 0);
			}
		}
		public function newPlaceLayer( name:String, x:int = 0, y:int = 0, depth:int = -1):PlaceLayer {
			var layer:PlaceLayer = new PlaceLayer( Application.application._assetPath + "//graphics//"+name );
			layer.x = x;
			layer.y = y;
			if( depth == -1 ){
				this.addChild( layer );
			} else {
				this.addChildAt( layer, depth );
			}
			return layer;
		}
		public function hotspotCallScript( name:String, script:String, x:int = 0, y:int = 0, depth:int = -1):void {
			var layer:PlaceLayer = this.newPlaceLayer( name, x, y, depth );
			layer.hotspotScript = script;
		}

	}
}